def print_http_headers(headers):
  for (key, value) in headers.items():
    print("%s: %s" % (key, value))
  print("")

def print_page_open(title, extra=""):
  print('<html>')
  print('<head>')
  print('<title>%s</title>' % title)
  print('<link rel="stylesheet" type="text/css" href="css/screen.css" />')
  print('<link rel="shortcut icon" href="favicon.ico" />')
  print(extra)
  print('</head>')

menu_link_ids = {}
menu_link_ids["gallery.cgi"] = "link_gallery"
menu_link_ids["login.cgi"] = "link_login"
menu_link_ids["logout.cgi"] = "link_logout"
menu_link_ids["album_picture_add.cgi"] = "link_albumpictureadd"
menu_link_ids["gallery_admin_user_add.cgi"] = "link_galleryadminuseradd"
def print_page_menu(links):
  print('<ul id="main_menu">')
  for link in links:
    try:
      id = menu_link_ids[link[1]]
    except KeyError:
      id = ""
    print('<li id="%s"><a href="%s">%s</a></li>' 
        % (id, link[1], link[0]))
  print('</ul>')

def print_page_close():
  print('</body>')
  print('</html>')

def print_file(file):
  f = open(file, "r")
  s = f.read()
  print(s)
